package com.example.demo2;

import com.example.demo2.services.User;
import com.example.demo2.services.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;

@Configuration
@ComponentScan
public class Demo2Application {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(Demo2Application.class);
        UserService userService = context.getBean(UserService.class);
        User user = userService.login("bob@example.com", "password");

        System.out.println(user.getName());

    }

}
